/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.monopoly.comunicazione;

import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author Administrator
 */
public class Server extends Thread {

    @Override
    public void run() {
        try {

            //Faccio partire il Thread per la gestione e l'invio dei messaggi!
            new DistributoreMessaggi().start();

            ServerSocket srv = new ServerSocket(1111);
            System.out.println("Parte Server!!!");
            while (true) {
                Socket s = srv.accept();
                ThreadCliente tc = new ThreadCliente(s);
                VariabiliGlobali.clienti.add(tc);
                tc.start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
